﻿<%@ Page Language="C#" MasterPageFile="~/Manager.master" AutoEventWireup="true" CodeFile="Catalogue.aspx.cs"
    Inherits="Manager_Catalogue_Catalogue" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div align="center">
        <table border="1" bordercolor="#407db3" cellpadding="2" cellspacing="2" class="tbl_Comon-Search"
            style="border-collapse: collapse" width="100%">
            <tr>
                <td align="center" colspan="1" rowspan="1" style="width: 84px" valign="top">
                    <asp:Button ID="btnSearch" runat="server" CssClass="cssButton" Text="Tìm kiếm" OnClick="btnSearch_Click1" /></td>
                <td class="td_Title" nowrap="nowrap" style="width: 63px">
                    <asp:Label ID="Label3" runat="server" CssClass="lbl_Common-Search" Text="Thể loại"></asp:Label></td>
                <td class="td_Control" nowrap="nowrap">
                    <asp:TextBox ID="txtTenTheLoai" runat="server" Width="98%"></asp:TextBox></td>
                <td class="td_Title" nowrap="nowrap" style="width: 57px">
                    <asp:Label ID="Label2" runat="server" CssClass="lbl_Common-Search" Text="Chủ đề"></asp:Label></td>
                <td align="left" style="width: 89px">
                    <asp:DropDownList ID="ddlChuDe" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlChuDe_SelectedIndexChanged">
                    </asp:DropDownList></td>
            </tr>
            <tr>
                <td align="left" colspan="5" rowspan="1" valign="top">
                    <asp:Button ID="btnAdd_Catalogue" runat="server" CssClass="cssButton" Text="Thêm mới"
                        OnClick="btnAdd_Catalogue_Click" /></td>
            </tr>
        </table>
        <br />
    </div>
    <div align="center">
        <asp:GridView ID="grv_Master" runat="server" AllowPaging="True" AllowSorting="True"
            AutoGenerateColumns="False" DataKeyNames="CatID" Width="100%" CellPadding="2"
            BorderColor="#407db3" OnRowCreated="grv_Master_RowCreated" OnRowDataBound="grv_Master_RowDataBound"
            OnRowEditing="grv_Master_RowEditing" OnRowCancelingEdit="grv_Master_RowCancelingEdit"
            OnRowUpdating="grv_Master_RowUpdating" OnRowDeleting="grv_Master_RowDeleting"
            PageSize="20" OnPageIndexChanging="grv_Master_PageIndexChanging">
            <Columns>
                <asp:TemplateField>
                    <ItemTemplate>
                        <img src='../../Images/Icon/cmdEdit.gif' border="0" alt="Edit" style="cursor: pointer"
                            onclick='hrUpdateCatalogue(this,<%# Eval("TopicID") %>,<%# Eval("CatID") %>)'
                            catname='<%# Eval("CatName") %>' kindno='<%# Eval("KindNo") %>' />
                    </ItemTemplate>
                    <ItemStyle CssClass="cssBorderGrv" HorizontalAlign="Center" Width="10px" />
                    <HeaderStyle CssClass="cssBorderGrv" />
                </asp:TemplateField>
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:LinkButton ID="lblDelete" runat="server" CommandName="delete" Text="<img src=../../Images/Icon/cmdDelete.gif border=0 alt=Delete > "></asp:LinkButton>
                    </ItemTemplate>
                    <ItemStyle CssClass="cssBorderGrv" HorizontalAlign="Center" Width="10px" />
                    <HeaderStyle CssClass="cssBorderGrv" />
                </asp:TemplateField>
                <asp:TemplateField>
                    <HeaderTemplate>
                        Tên thể loại
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("CatName") %>'></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox ID="txtETenMn" runat="server" Text='<%# Eval("CatName") %>' Width="95%"></asp:TextBox>
                    </EditItemTemplate>
                    <ItemStyle CssClass="cssBorderGrv" HorizontalAlign="Left" Width="80%" />
                    <HeaderStyle CssClass="cssBorderGrv" HorizontalAlign="Left" />
                </asp:TemplateField>
                <asp:TemplateField>
                    <HeaderTemplate>
                        Tên chủ đề
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:Label ID="lblLevelMenu" runat="server" Text=''></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:DropDownList ID="ddlLevelMenu" runat="server" DataSource="<%#Bind_Edit_DropList_Menu() %>"
                            DataTextField="TopicName" DataValueField="TopicID">
                        </asp:DropDownList>
                    </EditItemTemplate>
                    <ItemStyle CssClass="cssBorderGrv" HorizontalAlign="Left" Width="25%" />
                    <HeaderStyle CssClass="cssBorderGrv" HorizontalAlign="Left" />
                </asp:TemplateField>
                <asp:TemplateField>
                    <HeaderTemplate>
                        Xem
                    </HeaderTemplate>
                    <ItemTemplate>
                        <asp:CheckBox ID="chkViewChose" runat="server" Enabled="false" />
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:CheckBox ID="chkEditChose" runat="server" />
                    </EditItemTemplate>
                    <ItemStyle CssClass="cssBorderGrv" HorizontalAlign="Left" Width="1%" />
                    <HeaderStyle CssClass="cssBorderGrv" HorizontalAlign="Left" Wrap="False" />
                </asp:TemplateField>
            </Columns>
            <RowStyle CssClass="gvRowStyle" />
            <AlternatingRowStyle CssClass="gvAlternatingRowStyle" />
            <HeaderStyle CssClass="gvHeader" />
            <PagerStyle HorizontalAlign="Left" />
        </asp:GridView>
        <input type="hidden" id="hidProperties" runat="server" />
        <input type="hidden" runat="server" id="hidMethod" />

        <script language="javascript" type="text/javascript">
  
    function hrUpdateCatalogue(obj,TopicID,CatID)
    {
        var CatName=obj.getAttribute("CatName");
             var KindNo=obj.getAttribute("KindNo");  
        var ddlChuDe=document.getElementById("<%= ddlChuDe.ClientID %>");   
        var CodeID='<%= Request.QueryString["CodeID"]%>';
        window.location.href="AddCatalogue.aspx?KindNo="+KindNo+"&sTopicID="+ddlChuDe.value+"&CatName="+CatName+"&TopicID="+ TopicID+"&CatID="+CatID+"&CodeID="+CodeID;
    }
    
        </script>
</asp:Content>
